@extends('layouts.back_stage')
@section('content')
    <style>
        .brand_id{width:150px;}
        .style_id{width: 150px;display: inline-block;}
    </style>
    <div class="container">
        <div style="padding: 20px 0;">
            <h3 >库存查询</h3>
        </div>
        <div class="flow_head_box">
            <form action="">
            <label>品牌：</label>
            <select class="address brand_id" name="brand_id">
                @if(isset($_GET['brand_id']) && $_GET['brand_id'] )
                    <option value="{{ $_GET['brand_id'] }}">{{ $brands[$_GET['brand_id']] }}</option>
                @else
                    <option value="">请选择</option>
                @endif

                @foreach($brands as $k=>$v)
                    <option value="{{ $k }}">{{ $v }}</option>
                @endforeach
            </select>
            <label>款号：</label>
            <input type="text" name="girard" value="{{ $girard }}" class="address style_id" placeholder="输入款号">
            <input class="btn btn-info" style="margin-bottom:3px;" type="submit" value="搜索" >
            </form>
        </div>
        <span style="display:none;" class="info_sum">{{$all_goods_count}}</span>
        <table  border="0" cellspacing="0" class="table table-hover" style="margin-top:20px;">
            <thead>
            <tr>
                <th>品牌</th>
                <th>款号</th>
                <th>颜色</th>
                <th>总库存</th>
                <th>可用库存</th>
                <th>占用库存</th>
                <th>在途库存</th>
                <th>剩余库存</th>
            </tr>
            </thead>
            <tbody>
            @if(isset($all_goods))
            @foreach($all_goods as $k=>$v)
                <tr>
                    <td>{{ $brands[$v->brand] }}</td>
                    <td>{{ $v->item }}</td>
                    <td>{{ $v->color }}</td>
                    <td>{{ $v->all_hands }}</td>
                    <td>{{ $v->all_hands - $v->road_stock - $v->hold_stock - $v->old_stock}}</td>
                    <td>{{ $v->hold_stock }}</td>
                    <td>{{ $v->road_stock }}</td>
                    <td>{{ $v->residue }}</td>
                </tr>
            @endforeach
            @endif
            </tbody>
        </table>
        <div style="float:right"><div style="float: right;margin:20px 0;" class="return_box"><button class="btn btn-info" onclick="returnPage()" style="float:right;">跳转</button><input type="text" class="form-control returnPage" style="width:6rem;float: right;margin:0 5px;"></div>{!! $all_goods->appends(['brand_id'=>$brand_id,'girard'=>$girard])->links() !!}</div>
    </div>
@endsection
@section('style')
    @parent
    <link href="{{env('CDN_DOMAIN_NAME')}}/css/style.css?v=4.1.0" rel="stylesheet">
@endsection
@section('script')
    @parent
    <script src="{{ env('CDN_DOMAIN_NAME') }}/js/moment.js" type="text/javascript"></script>
    <script src="{{ env('CDN_DOMAIN_NAME') }}/js/daterangepicker.js" type="text/javascript"></script>
@endsection